﻿@{
    ViewData["Title"] = "ViewerJS Page";
}

<style>
    body {
        height: 100%;
        width: 100%;
    }

    div {
        height: 100%;
    }
</style>
<div class="text-center" style="width:100%;height:100%">
    ViewerJS
    <a href="@Url.Action("Download","Home",new  { fileName="采购入库扫描项目目标及实现方式.odt"})">下载</a>
    <a href="/lib/ViewerJS/index.html#../..@Url.Action("Download","Home",new  { fileName="采购入库扫描项目目标及实现方式.odt"})">预览</a>


    @*<iframe style="float: right; width: 600px; height: 300px" src="~/lib/ViewerJS/index.html#../..@Url.Action("Download","Home",new  { fileName="采购入库扫描项目目标及实现方式.odt"})" allowfullscreen webkitallowfullscreen></iframe>*@
    <iframe style="float: right; width: 600px; height: 300px" src="/lib/ViewerJS/index.html#../..@Url.Action("Download","Home",new  { fileName="HTTP.pdf"})" allowfullscreen webkitallowfullscreen></iframe>
    <iframe style="float: right; width: 600px; height: 300px" src="@Url.Action("Index","ViewerJS")#@Url.Action("Download","Home",new  { fileName="HTTP.PDF"})" allowfullscreen webkitallowfullscreen></iframe>
    <iframe style="float: right; width: 600px; height: 300px" id="displayPdfIframe" allowfullscreen webkitallowfullscreen></iframe>
</div>

@section Scripts{ 
    <script type="text/javascript">
    $(function () {
        var dwonloadUrl = "@Url.Action("Download","Home",new  { fileName= "HTTP.pdf" })";
        var src = "@Url.Action("Index","ViewerJS")";
        var file = "file=" + dwonloadUrl;
        src = src + "#" + dwonloadUrl;
        //var src = '<c:url value="@Url.Action("Index","ViewerJS")" />?file=' + encodeURIComponent('<c:url value="' + dwonloadUrl+'"/>');
        console.log(src);
        $("#displayPdfIframe").attr("src", src);
    });
    </script>
}